<!-- HTML header for doxygen 1.8.13-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.13"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>MTB CAT1 Peripheral driver library: Functions</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
  $(document).ready(initResizable);
</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen_style.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><a href="http://www.cypress.com/"><img alt="Logo" src="IFXCYP_one-line.png"/></a></td>
  <td id="projectalign" style="padding-left: 0.5em;">
   <div id="projectname">MTB CAT1 Peripheral driver library</div>
  </td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.13 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
$(function() {
  initMenu('',true,false,'search.php','Search');
  $(document).ready(function() { init_search(); });
});
</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
$(document).ready(function(){initNavTree('group__group__sysclk__eco__funcs.html','');});
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="summary">
<a href="#func-members">Functions</a>  </div>
  <div class="headertitle">
<div class="title">Functions<div class="ingroups"><a class="el" href="group__group__sysclk.html">SysClk       (System Clock)</a> &raquo; <a class="el" href="group__group__sysclk__eco.html">External Crystal Oscillator (ECO)</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">General Description</h2>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="func-members"></a>
Functions</h2></td></tr>
<tr class="memitem:ga4ff4c716a35e5077d000120d0994ad7b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#ga4ff4c716a35e5077d000120d0994ad7b">Cy_SysClk_EcoSetFrequency</a> (uint32_t freq)</td></tr>
<tr class="memdesc:ga4ff4c716a35e5077d000120d0994ad7b"><td class="mdescLeft">&#160;</td><td class="mdescRight">Stores the external crystal oscillator (ECO) frequency in a global variable within Sysclk driver.  <a href="#ga4ff4c716a35e5077d000120d0994ad7b">More...</a><br /></td></tr>
<tr class="separator:ga4ff4c716a35e5077d000120d0994ad7b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaa247c91ce4f872f224aed426ad317973"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#gaa247c91ce4f872f224aed426ad317973">Cy_SysClk_EcoManualConfigure</a> (const <a class="el" href="structcy__stc__clk__eco__config__t.html">cy_stc_clk_eco_config_t</a> *ecoConfig)</td></tr>
<tr class="memdesc:gaa247c91ce4f872f224aed426ad317973"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures the external crystal oscillator (ECO) trim bits based on crystal characteristics.  <a href="#gaa247c91ce4f872f224aed426ad317973">More...</a><br /></td></tr>
<tr class="separator:gaa247c91ce4f872f224aed426ad317973"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga9d94ac55503404a0bdaf017fe33ecdbd"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#ga9d94ac55503404a0bdaf017fe33ecdbd">Cy_SysClk_EcoConfigure</a> (uint32_t freq, uint32_t cSum, uint32_t esr, uint32_t driveLevel)</td></tr>
<tr class="memdesc:ga9d94ac55503404a0bdaf017fe33ecdbd"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures the external crystal oscillator (ECO) trim bits based on crystal characteristics.  <a href="#ga9d94ac55503404a0bdaf017fe33ecdbd">More...</a><br /></td></tr>
<tr class="separator:ga9d94ac55503404a0bdaf017fe33ecdbd"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gaadd2986e0b77ab0a714e4127ef1693f6"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#gaadd2986e0b77ab0a714e4127ef1693f6">Cy_SysClk_EcoEnable</a> (uint32_t timeoutus)</td></tr>
<tr class="memdesc:gaadd2986e0b77ab0a714e4127ef1693f6"><td class="mdescLeft">&#160;</td><td class="mdescRight">Enables the external crystal oscillator (ECO).  <a href="#gaadd2986e0b77ab0a714e4127ef1693f6">More...</a><br /></td></tr>
<tr class="separator:gaadd2986e0b77ab0a714e4127ef1693f6"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga392db1f8d8504409017a3fedb95b8ee2"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#ga392db1f8d8504409017a3fedb95b8ee2">Cy_SysClk_EcoGetFrequency</a> (void)</td></tr>
<tr class="memdesc:ga392db1f8d8504409017a3fedb95b8ee2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the frequency of the external crystal oscillator (ECO).  <a href="#ga392db1f8d8504409017a3fedb95b8ee2">More...</a><br /></td></tr>
<tr class="separator:ga392db1f8d8504409017a3fedb95b8ee2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gab97a44bef89cdc85e5bcdc80098c1cef"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#gab97a44bef89cdc85e5bcdc80098c1cef">Cy_SysClk_EcoDisable</a> (void)</td></tr>
<tr class="memdesc:gab97a44bef89cdc85e5bcdc80098c1cef"><td class="mdescLeft">&#160;</td><td class="mdescRight">Disables the external crystal oscillator (ECO).  <a href="#gab97a44bef89cdc85e5bcdc80098c1cef">More...</a><br /></td></tr>
<tr class="separator:gab97a44bef89cdc85e5bcdc80098c1cef"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga55bbf5f409d57259aff005b29be026e0"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#ga55bbf5f409d57259aff005b29be026e0">Cy_SysClk_EcoGetStatus</a> (void)</td></tr>
<tr class="memdesc:ga55bbf5f409d57259aff005b29be026e0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reports the current status of the external crystal oscillator (ECO).  <a href="#ga55bbf5f409d57259aff005b29be026e0">More...</a><br /></td></tr>
<tr class="separator:ga55bbf5f409d57259aff005b29be026e0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:gad88e518519a4a228b73a8a74db672d71"><td class="memItemLeft" align="right" valign="top"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a>&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#gad88e518519a4a228b73a8a74db672d71">Cy_SysClk_EcoPrescaleConfigure</a> (uint32_t enable, uint32_t int_div, uint32_t frac_div)</td></tr>
<tr class="memdesc:gad88e518519a4a228b73a8a74db672d71"><td class="mdescLeft">&#160;</td><td class="mdescRight">Configures the external crystal oscillator (ECO) using ECO Prescaler Configuration Register and derives clk_eco_prescaler.  <a href="#gad88e518519a4a228b73a8a74db672d71">More...</a><br /></td></tr>
<tr class="separator:gad88e518519a4a228b73a8a74db672d71"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga6b6d1333ee4c882360f7a932c13a3e90"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#ga6b6d1333ee4c882360f7a932c13a3e90">Cy_SysClk_EcoPrescaleIsEnabled</a> (void)</td></tr>
<tr class="memdesc:ga6b6d1333ee4c882360f7a932c13a3e90"><td class="mdescLeft">&#160;</td><td class="mdescRight">Reports whether or not ECO Prescale is enabled.  <a href="#ga6b6d1333ee4c882360f7a932c13a3e90">More...</a><br /></td></tr>
<tr class="separator:ga6b6d1333ee4c882360f7a932c13a3e90"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ga5e7f15749a28bb1f79712e587a9822f1"><td class="memItemLeft" align="right" valign="top">uint32_t&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="group__group__sysclk__eco__funcs.html#ga5e7f15749a28bb1f79712e587a9822f1">Cy_SysClk_EcoPrescaleGetFrequency</a> (void)</td></tr>
<tr class="memdesc:ga5e7f15749a28bb1f79712e587a9822f1"><td class="mdescLeft">&#160;</td><td class="mdescRight">Returns the frequency of the external crystal oscillator (ECO) prescaler.  <a href="#ga5e7f15749a28bb1f79712e587a9822f1">More...</a><br /></td></tr>
<tr class="separator:ga5e7f15749a28bb1f79712e587a9822f1"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<h2 class="groupheader">Function Documentation</h2>
<a id="ga4ff4c716a35e5077d000120d0994ad7b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga4ff4c716a35e5077d000120d0994ad7b">&#9670;&nbsp;</a></span>Cy_SysClk_EcoSetFrequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SysClk_EcoSetFrequency </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Stores the external crystal oscillator (ECO) frequency in a global variable within Sysclk driver. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">freq</td><td>Operating frequency of the crystal in Hz. Valid range: 16000000...35000000 (16..35 MHz).</td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1A (excluding TVIIBE), CAT1B, CAT1C and CAT1D devices. </dd></dl>

</div>
</div>
<a id="gaa247c91ce4f872f224aed426ad317973"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaa247c91ce4f872f224aed426ad317973">&#9670;&nbsp;</a></span>Cy_SysClk_EcoManualConfigure()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> Cy_SysClk_EcoManualConfigure </td>
          <td>(</td>
          <td class="paramtype">const <a class="el" href="structcy__stc__clk__eco__config__t.html">cy_stc_clk_eco_config_t</a> *&#160;</td>
          <td class="paramname"><em>ecoConfig</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configures the external crystal oscillator (ECO) trim bits based on crystal characteristics. </p>
<p>This function should be called only when the ECO is disabled.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">ecoConfig</td><td><a class="el" href="structcy__stc__clk__eco__config__t.html">cy_stc_clk_eco_config_t</a></td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>This API expects the trims to be calculated outside this API scope, so refer and use the ECO calculators excel sheet for the platform to obtain the trims.</dd></dl>
<dl class="section return"><dt>Returns</dt><dd>Error / status code: <br />
CY_SYSCLK_SUCCESS - ECO configuration completed successfully <br />
CY_SYSCLK_BAD_PARAM - One or more invalid parameters <br />
CY_SYSCLK_INVALID_STATE - ECO already enabled</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1D devices. </dd></dl>

</div>
</div>
<a id="ga9d94ac55503404a0bdaf017fe33ecdbd"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga9d94ac55503404a0bdaf017fe33ecdbd">&#9670;&nbsp;</a></span>Cy_SysClk_EcoConfigure()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> Cy_SysClk_EcoConfigure </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>freq</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>cSum</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>esr</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>driveLevel</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configures the external crystal oscillator (ECO) trim bits based on crystal characteristics. </p>
<p>This function should be called only when the ECO is disabled.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">freq</td><td>Operating frequency of the crystal in Hz. Valid range: 16000000...35000000 (16..35 MHz).</td></tr>
    <tr><td class="paramname">cSum</td><td>The summary capacitance of C0 (the crystal itself shunt capacitance) and Cload (the parallel load capacitance), in pF. So cSum = C0 + Cload. Valid range: 1...100. </td></tr>
  </table>
  </dd>
</dl>
<dl class="section note"><dt>Note</dt><dd>For CAT1B Devices: cSum stands for crystal load capacitance in pF.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">esr</td><td>Effective series resistance of the crystal in Ohms. Valid range: 1...1000.</td></tr>
    <tr><td class="paramname">driveLevel</td><td>Crystal drive level in uW. Valid range: 1...2000.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error / status code: <br />
 CY_SYSCLK_SUCCESS - ECO configuration completed successfully <br />
 CY_SYSCLK_BAD_PARAM - One or more invalid parameters <br />
 CY_SYSCLK_INVALID_STATE - ECO already enabled </dd></dl>
<dl class="section note"><dt>Note</dt><dd>Behavior of this API is IP dependent. <br />
 On CAT1A device: <br />
 For the PSoC 64 devices there are possible situations when function returns the PRA error status code. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to <a class="el" href="group__group__pra__enums.html#ga60be13e12e82986f8c0d6c6a6d4f12c5">cy_en_pra_status_t</a> for more details. The following calculations are implemented in the 32-bit integer math: On PSoC 64 devices the configuration on the PRA driver will be reflected after <a class="el" href="group__group__sysclk__eco__funcs.html#gaadd2986e0b77ab0a714e4127ef1693f6">Cy_SysClk_EcoEnable</a> call.</dd></dl>
<pre class="fragment">*   freqKhz = freq / 1000
*   maxAmpl = sqrt(drivelevel / 2 / esr) / 3.14 / freqKhz / cSum
*   ampSect = INT(5 * 4 * 3.14^2 * freqKhz^2 * cSum^2 * 4 * esr / 1000000000 / 1000000 / 9)
*   As a result of the above calculations, max amplitude must be &gt;= 0.65V, and the
*   number of amplifier sections must be &lt;= 3, otherwise this function returns with
*   a parameter error.
*
*   atrim = 15
*   agc_en = 1
*   wdtrim = 7
*   gtrim = ampSect &gt; 1 ? ampSect : ampSect == 1 ? 0 : 1
*   rtrim = 0
*   ftrim = 3
* </pre><dl class="section note"><dt>Note</dt><dd>On CAT1C Device: <br />
 <pre class="fragment">*   No TRIM registers configuration required for CAT1B devices, For legacy API is emptied
*   The following calculations are implemented, generally in floating point:
*   freqMHz = freq / 1000000
*   max amplitude Vpp = 1000 * sqrt(drivelevel / 2 / esr) / 3.14 / freqMHz / cLoad
*   gm_min mA/V = 5 * 4 * 3.14 * 3.14 * freqMhz^2 * cLoad^2 * 4 * esr / 1000000000
*   Number of amplifier sections = INT(gm_min / 4.5)
*
*   As a result of the above calculations, max amplitude must be &gt;= 0.5, and the
*   number of amplifier sections must be &lt;= 3, otherwise this function returns with
*   a parameter error.
*
*   atrim = if (max amplitude &lt; 0.5) then error
*           else 2 * the following:
*                    max amplitude &lt; 0.6: 0
*                    max amplitude &lt; 0.7: 1
*                    max amplitude &lt; 0.8: 2
*                    max amplitude &lt; 0.9: 3
*                    max amplitude &lt; 1.15: 5
*                    max amplitude &lt; 1.275: 6
*                    max amplitude &gt;= 1.275: 7
*   wdtrim = if (max amplitude &lt; 0.5) then error
*            else 2 * the following:
*                     max amplitude &lt; 1.2: INT(5 * max amplitude) - 2
*                     max amplitude &gt;= 1.2: 3
*   gtrim = if (number of amplifier sections &gt; 3) then error
*           else the following:
*                number of amplifier sections &gt; 1: number of amplifier sections
*                number of amplifier sections = 1: 0
*                number of amplifier sections &lt; 1: 1
*   rtrim = if (gtrim = error) then error
*           else the following:
*                freqMHz &gt; 26.8: 0
*                freqMHz &gt; 23.33: 1
*                freqMHz &gt; 16.5: 2
*                freqMHz &lt;= 16.5: 3
*   ftrim = if (atrim = error) then error
*           else INT(atrim / 2)
* </pre></dd>
<dd>
This API is available for CAT1A, CAT1C and CAT1D devices.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: ECO needs to be configured. The ECO pins are configured using</span></div><div class="line"><span class="comment">                 the gpio driver (SRSS_ECO_IN_PIN, SRSS_ECO_OUT_PIN). The ECO</span></div><div class="line"><span class="comment">                 crystal has the following characteristics:</span></div><div class="line"><span class="comment">                   Frequency: 17.2032 MHz</span></div><div class="line"><span class="comment">                   Parallel load crystal capacitance: 22 pF</span></div><div class="line"><span class="comment">                   Crystal shunt capacitance: 7 pF</span></div><div class="line"><span class="comment">                   Effective series resistance: 40 Ohm</span></div><div class="line"><span class="comment">                   Drive level: 500 uW */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Disable the ECO before configuring */</span></div><div class="line">    <a class="code" href="group__group__sysclk__eco__funcs.html#gab97a44bef89cdc85e5bcdc80098c1cef">Cy_SysClk_EcoDisable</a>();</div><div class="line"></div><div class="line">    <span class="comment">/* Configure the ECO with its characteristics */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> != <a class="code" href="group__group__sysclk__eco__funcs.html#ga9d94ac55503404a0bdaf017fe33ecdbd">Cy_SysClk_EcoConfigure</a>(17203200UL,  <span class="comment">/* 17.2032 MHz */</span></div><div class="line">                                                   29UL,        <span class="comment">/* 7 pF C0 + 22 pF Cload */</span></div><div class="line">                                                   40UL,        <span class="comment">/* 40 Ohms */</span></div><div class="line">                                                   500UL))      <span class="comment">/* 500 uW */</span></div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Enable the ECO with a timeout of 3000 microseconds */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> != <a class="code" href="group__group__sysclk__eco__funcs.html#gaadd2986e0b77ab0a714e4127ef1693f6">Cy_SysClk_EcoEnable</a>(3000UL))</div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gaadd2986e0b77ab0a714e4127ef1693f6"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gaadd2986e0b77ab0a714e4127ef1693f6">&#9670;&nbsp;</a></span>Cy_SysClk_EcoEnable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> Cy_SysClk_EcoEnable </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>timeoutus</em></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Enables the external crystal oscillator (ECO). </p>
<p>This function should be called after <a class="el" href="group__group__sysclk__eco__funcs.html#ga9d94ac55503404a0bdaf017fe33ecdbd">Cy_SysClk_EcoConfigure</a>.</p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">timeoutus</td><td>Amount of time in microseconds to wait for the ECO to stabilize. To avoid waiting for stabilization, set this parameter to 0.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error / status code: <br />
CY_SYSCLK_SUCCESS - ECO locked <br />
CY_SYSCLK_TIMEOUT - ECO timed out and did not lock <br />
CY_SYSCLK_INVALID_STATE - ECO already enabled <br />
CY_SYSCLK_UNSUPPORTED_STATE - ECO is not present For the PSoC 64 devices there are possible situations when function returns the PRA error status code. This is because for PSoC 64 devices the function uses the PRA driver to change the protected registers. Refer to <a class="el" href="group__group__pra__enums.html#ga60be13e12e82986f8c0d6c6a6d4f12c5">cy_en_pra_status_t</a> for more details.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>Call <a class="el" href="group__group__startup__config__system__functions.html#gae0c36a9591fe6e9c45ecb21a794f0f0f">SystemCoreClockUpdate</a> after this function calling if it affects the CLK_HF0 frequency.</dd>
<dd>
This API is available for CAT1A &amp; CAT1C devices.</dd>
<dd>
Take into account the possible platform specific clkHf (and further clocking chain links) frequency limitations while using this API.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: ECO is successfully configured and needs to be enabled. The</span></div><div class="line"><span class="comment">                 ECO pins are configured using the gpio driver</span></div><div class="line"><span class="comment">                 (SRSS_ECO_IN_PIN, SRSS_ECO_OUT_PIN). */</span></div><div class="line"></div><div class="line">    uint32_t ecofreq = 0UL; <span class="comment">/* Variable to store the ECO frequency */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Enable the ECO with a timeout of 1000 microseconds */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> == <a class="code" href="group__group__sysclk__eco__funcs.html#gaadd2986e0b77ab0a714e4127ef1693f6">Cy_SysClk_EcoEnable</a>(1000UL))</div><div class="line">    {</div><div class="line">        ecofreq = <a class="code" href="group__group__sysclk__eco__funcs.html#ga392db1f8d8504409017a3fedb95b8ee2">Cy_SysClk_EcoGetFrequency</a>();</div><div class="line">        <span class="comment">/* Now ecofreq contains an actual ECO frequency */</span></div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the path muxes and configure the downstream clocks. For example,</span></div><div class="line"><span class="comment">       the ECO can source the FLL through path 0 clock or it can source the PLL</span></div><div class="line"><span class="comment">       through path 1 clock. */</span></div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="ga392db1f8d8504409017a3fedb95b8ee2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga392db1f8d8504409017a3fedb95b8ee2">&#9670;&nbsp;</a></span>Cy_SysClk_EcoGetFrequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Cy_SysClk_EcoGetFrequency </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the frequency of the external crystal oscillator (ECO). </p>
<dl class="section return"><dt>Returns</dt><dd>The frequency of the ECO.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the ECO is not enabled or stable - a zero is returned.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: ECO is successfully configured and needs to be enabled. The</span></div><div class="line"><span class="comment">                 ECO pins are configured using the gpio driver</span></div><div class="line"><span class="comment">                 (SRSS_ECO_IN_PIN, SRSS_ECO_OUT_PIN). */</span></div><div class="line"></div><div class="line">    uint32_t ecofreq = 0UL; <span class="comment">/* Variable to store the ECO frequency */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Enable the ECO with a timeout of 1000 microseconds */</span></div><div class="line">    <span class="keywordflow">if</span>(<a class="code" href="group__group__sysclk__returns.html#ggad6699a184e2e3c01433251b0981558f3a1563f761f963757b339ff05eb5a690ec">CY_SYSCLK_SUCCESS</a> == <a class="code" href="group__group__sysclk__eco__funcs.html#gaadd2986e0b77ab0a714e4127ef1693f6">Cy_SysClk_EcoEnable</a>(1000UL))</div><div class="line">    {</div><div class="line">        ecofreq = <a class="code" href="group__group__sysclk__eco__funcs.html#ga392db1f8d8504409017a3fedb95b8ee2">Cy_SysClk_EcoGetFrequency</a>();</div><div class="line">        <span class="comment">/* Now ecofreq contains an actual ECO frequency */</span></div><div class="line">    }</div><div class="line">    <span class="keywordflow">else</span></div><div class="line">    {</div><div class="line">        <span class="comment">/* Insert error handling */</span></div><div class="line">    }</div><div class="line"></div><div class="line">    <span class="comment">/* Set the path muxes and configure the downstream clocks. For example,</span></div><div class="line"><span class="comment">       the ECO can source the FLL through path 0 clock or it can source the PLL</span></div><div class="line"><span class="comment">       through path 1 clock. */</span></div></div><!-- fragment --> </dd></dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1A, CAT1B(PSOC C3), CAT1C &amp; CAT1D devices. </dd></dl>

</div>
</div>
<a id="gab97a44bef89cdc85e5bcdc80098c1cef"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gab97a44bef89cdc85e5bcdc80098c1cef">&#9670;&nbsp;</a></span>Cy_SysClk_EcoDisable()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">void Cy_SysClk_EcoDisable </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Disables the external crystal oscillator (ECO). </p>
<p>This function should not be called if the ECO is sourcing clkHf[0].</p>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: ECO sources path 2 clock, which sources HFCLK2. The ECO needs</span></div><div class="line"><span class="comment">                 to be disabled and replaced with the IMO for HFCLK2 */</span></div><div class="line"></div><div class="line">    <span class="comment">/* Update the path 2 clock to IMO */</span></div><div class="line">    (void)<a class="code" href="group__group__sysclk__path__src__funcs.html#ga517f603266062d0013947ea950ed5b60">Cy_SysClk_ClkPathSetSource</a>(2UL, <a class="code" href="group__group__sysclk__path__src__enums.html#gga8ddaf9023a02dee0d1f9a5629d6ccfe6a01c7cbab413a99daa41d2fb7a0340955">CY_SYSCLK_CLKPATH_IN_IMO</a>);</div><div class="line"></div><div class="line">    <span class="comment">/* Disable the ECO */</span></div><div class="line">    <a class="code" href="group__group__sysclk__eco__funcs.html#gab97a44bef89cdc85e5bcdc80098c1cef">Cy_SysClk_EcoDisable</a>();</div></div><!-- fragment --> </dd></dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1A, CAT1C devices. </dd></dl>

</div>
</div>
<a id="ga55bbf5f409d57259aff005b29be026e0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga55bbf5f409d57259aff005b29be026e0">&#9670;&nbsp;</a></span>Cy_SysClk_EcoGetStatus()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Cy_SysClk_EcoGetStatus </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reports the current status of the external crystal oscillator (ECO). </p>
<dl class="section return"><dt>Returns</dt><dd>CY_SYSCLK_ECOSTAT_AMPLITUDE = ECO does not have sufficient amplitude <br />
CY_SYSCLK_ECOSTAT_INACCURATE = ECO has sufficient amplitude but may not be meeting accuracy and duty cycle specifications <br />
CY_SYSCLK_ECOSTAT_STABLE = ECO has fully stabilized</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1A, CAT1C devices.</dd></dl>
<dl class="section user"><dt>Function Usage</dt><dd><div class="fragment"><div class="line">    <span class="comment">/* Scenario: Query the status of the ECO */</span></div><div class="line"></div><div class="line">    uint32_t ecoStatus = <a class="code" href="group__group__sysclk__eco__funcs.html#ga55bbf5f409d57259aff005b29be026e0">Cy_SysClk_EcoGetStatus</a>();</div><div class="line"></div><div class="line">    <span class="comment">/* Perform action based on the ECO status */</span></div><div class="line">    <span class="keywordflow">switch</span>(ecoStatus)</div><div class="line">    {</div><div class="line">        <span class="keywordflow">case</span> <a class="code" href="group__group__sysclk__ecostatus.html#ga1eb088e2bce67f0b1c8e8956d12ee6d9">CY_SYSCLK_ECOSTAT_AMPLITUDE</a>:</div><div class="line">            <span class="comment">/* Amplitude is not sufficient. Try waiting longer before</span></div><div class="line"><span class="comment">               attempting to reconfigure the ECO */</span></div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">        <span class="keywordflow">case</span> <a class="code" href="group__group__sysclk__ecostatus.html#ga9890a5835f8dea7ae3596ea242911ae1">CY_SYSCLK_ECOSTAT_INACCURATE</a>:</div><div class="line">            <span class="comment">/* Amplitude is correct but the ECO is not yet stable. Try</span></div><div class="line"><span class="comment">               waiting longer before attempting to reconfigure the ECO */</span></div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">        <span class="keywordflow">case</span> <a class="code" href="group__group__sysclk__ecostatus.html#ga1fbb771899bde3d2a8914bdfab9d47a0">CY_SYSCLK_ECOSTAT_STABLE</a>:</div><div class="line">            <span class="comment">/* ECO is stable and ready for use */</span></div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">        <span class="keywordflow">default</span>:</div><div class="line">            <span class="comment">/* Invalid state. Perform error handling. */</span></div><div class="line">        <span class="keywordflow">break</span>;</div><div class="line">    }</div></div><!-- fragment --></dd></dl>

</div>
</div>
<a id="gad88e518519a4a228b73a8a74db672d71"></a>
<h2 class="memtitle"><span class="permalink"><a href="#gad88e518519a4a228b73a8a74db672d71">&#9670;&nbsp;</a></span>Cy_SysClk_EcoPrescaleConfigure()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname"><a class="el" href="group__group__sysclk__returns.html#gad6699a184e2e3c01433251b0981558f3">cy_en_sysclk_status_t</a> Cy_SysClk_EcoPrescaleConfigure </td>
          <td>(</td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>enable</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>int_div</em>, </td>
        </tr>
        <tr>
          <td class="paramkey"></td>
          <td></td>
          <td class="paramtype">uint32_t&#160;</td>
          <td class="paramname"><em>frac_div</em>&#160;</td>
        </tr>
        <tr>
          <td></td>
          <td>)</td>
          <td></td><td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Configures the external crystal oscillator (ECO) using ECO Prescaler Configuration Register and derives clk_eco_prescaler. </p>
<dl class="params"><dt>Parameters</dt><dd>
  <table class="params">
    <tr><td class="paramname">enable</td><td>ECO Prescaler enable/disable.</td></tr>
    <tr><td class="paramname">int_div</td><td>10-bit integer value.</td></tr>
    <tr><td class="paramname">frac_div</td><td>8-bit fraction value.</td></tr>
  </table>
  </dd>
</dl>
<dl class="section return"><dt>Returns</dt><dd>Error / status code: <br />
CY_SYSCLK_SUCCESS - ECO configuration completed successfully <br />
CY_SYSCLK_BAD_PARAM - One or more invalid parameters <br />
CY_SYSCLK_INVALID_STATE - ECO already enabled <br />
CY_SYSCLK_UNSUPPORTED_STATE - ECO is not present</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1A (TVIIBE only) and CAT1C devices. </dd></dl>

</div>
</div>
<a id="ga6b6d1333ee4c882360f7a932c13a3e90"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga6b6d1333ee4c882360f7a932c13a3e90">&#9670;&nbsp;</a></span>Cy_SysClk_EcoPrescaleIsEnabled()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">bool Cy_SysClk_EcoPrescaleIsEnabled </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Reports whether or not ECO Prescale is enabled. </p>
<dl class="section return"><dt>Returns</dt><dd>false = disabled <br />
true = enabled</dd></dl>
<dl class="section note"><dt>Note</dt><dd>This API is available for CAT1A (TVIIBE only) and CAT1C devices. </dd></dl>

</div>
</div>
<a id="ga5e7f15749a28bb1f79712e587a9822f1"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ga5e7f15749a28bb1f79712e587a9822f1">&#9670;&nbsp;</a></span>Cy_SysClk_EcoPrescaleGetFrequency()</h2>

<div class="memitem">
<div class="memproto">
      <table class="memname">
        <tr>
          <td class="memname">uint32_t Cy_SysClk_EcoPrescaleGetFrequency </td>
          <td>(</td>
          <td class="paramtype">void&#160;</td>
          <td class="paramname"></td><td>)</td>
          <td></td>
        </tr>
      </table>
</div><div class="memdoc">

<p>Returns the frequency of the external crystal oscillator (ECO) prescaler. </p>
<dl class="section return"><dt>Returns</dt><dd>The frequency of the ECO Prescaler.</dd></dl>
<dl class="section note"><dt>Note</dt><dd>If the ECO is not enabled or stable - a zero is returned.</dd>
<dd>
This API is available for CAT1B(PSOC C3), CAT1C &amp; CAT1D devices. </dd></dl>

</div>
</div>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part
<div id="nav-path" class="navpath">
    <ul>
        <li class="footer">
            Generated for <b>MTB CAT1 Peripheral driver library</b> by <b>Cypress Semiconductor Corporation</b>.
            All rights reserved.
        </li>
    </ul>
</div>
-->
</body>
</html>
